// PUMAS 2000
insheet using "$dir/data/data_public/geocorr14.csv", clear names
	gen cty_fips = county14
	merge m:1 cty_fips using "$dir/data/data_public/cw_cty_czone.dta"
	drop if _merge==2
	gen cz_dummy  = (_merge==3)
	drop _merge
	rename state statefip
	gen     puma2000 = real(string(statefip) + "00" + string(puma2k)) if puma2k<1000 
	replace puma2000 = real(string(statefip) + "0" + string(puma2k)) if puma2k>=1000
	destring puma2kname, replace force
	keep puma2000 czone pop2k county14 afact
	

collapse (sum) pop2k (sum) afact, by(czone puma2000)

save "$dir/data/interim/cw_cty_czone_puma2000_afact.dta", replace

	
// PUMAS 2012	
insheet using "$dir/data/data_public/geocorr14_2010.csv", clear names
	gen cty_fips = real(county14)
	merge m:1 cty_fips using "$dir/data/data_public/cw_cty_czone.dta"
	drop if _merge==2
	gen cz_dummy  = (_merge==3)
	drop _merge
	rename state statefip
	gen     puma2012 = real(statefip + puma12)
	keep puma2012 czone pop2k county14 afact
	drop if county14 == "county14"
	destring county14 pop2k, replace

destring afact, gen(afact2)
drop afact
rename afact2 afact

collapse (sum) pop2k (sum) afact, by(czone puma2012)
save "$dir/data/interim/cw_cty_czone_puma2012_afact.dta", replace	


